package com.buffer.user.controller;

import com.buffer.user.service.UserService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    
    @GetMapping("/getUser")
    public String getUser() {
        return userService.getUser();
    }

    // 模拟失败的接口（用于触发熔断）
    @GetMapping("/testFallback")
    public ResponseEntity<String> testFallback() {
        // 返回500错误状态码，更容易触发熔断
        throw new RuntimeException("测试熔断");
    }
}